package com;

import java.util.ArrayList;
import java.util.List;

/**
 * @author reading
 * @Description TODO
 * @Date 2020/4/8 15:31
    */
public class sxwl {
    static List<String> list=new ArrayList<>();

    public static void main(String[] args) {
        list.add("/auth/login");
        list.add("/auth/login");
        list.add("/auth/verify");
        list.add("/user/register");
        list.add("/user/check");
        list.add("/user/code");

        boolean allowPath = isAllowPath("asdasdasd/user/code");
        System.out.println(allowPath);

    }

    private static boolean isAllowPath(String requestURI) {
        // 定义一个标记
        boolean flag = false;
        // 遍历允许访问的路径
        for (String path : list) {
            // 然后判断是否是符合
            if(requestURI.startsWith(path)){
                flag = true;
                break;
            }
        }
        return flag;
    }
}
